package com.hp.controller;

import com.hp.model.chain.OrderRequest;
import com.hp.service.chain.ValidationChain;
import jakarta.annotation.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hp
 */
@RestController
@RequestMapping("/api")
public class ChainController {

    @Resource
    private ValidationChain validationChain;

    @PostMapping("/chain")
    public ResponseEntity<?> createOrder(@RequestBody OrderRequest request) {
        validationChain.validateOrder(request);
        return ResponseEntity.ok("订单创建成功");

    }
}
